package com.lgqz.topsports.view;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.TextView;

import com.aspsine.swipetoloadlayout.SwipeRefreshTrigger;
import com.aspsine.swipetoloadlayout.SwipeTrigger;

/**
 * Description:
 * Copyright(c) 2016,邱国兴
 * This Program is protected by copyright laws
 * Created by Little Monster on 2016/12/16.
 *
 * @author 邱国兴
 */

public class RefreshHeaderView extends TextView implements SwipeRefreshTrigger, SwipeTrigger {
    public RefreshHeaderView(Context context) {
        super(context);
    }

    public RefreshHeaderView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public void onRefresh() {
        setText("拼命加载中。。。");
    }

    @Override
    public void onPrepare() {

    }

    @Override
    public void onMove(int yScrolled, boolean isComplete, boolean automatic) {
        if (!isComplete) {
            if (yScrolled >= getHeight()) {
                setText("取消刷新");
            } else {
                setText("滑动刷新");
            }
        } else {
            setText("刷新成功");
        }

    }

    @Override
    public void onRelease() {
        setText("拼命加载中。。。");
    }

    @Override
    public void onComplete() {
        setText("取消刷新");
    }

    @Override
    public void onReset() {

    }
}
